
!function(window){
    "use strict";
    window.app = {};
    (function(){
        var path = 'dev';
        var workName = 'm-featsky';
        var version = '0.0.1';
        var base = '';
        this.ajax = function(type,url,obj,sucCallback,errCallback,loadObj){
            $.ajax({
                type:type,
                url:url,
                data:obj,
                success:function(data,status){
                    sucCallback(JSON.parse(data),status)
                },
                error:function(xhr,err,msg){
                    if(errCallback){
                        //errCallback(xhr,err,msg);
                        com.prompt(0,'网络错误');
                    }
                },
                timeout:4000,
                beforeSend:function(){
                    if(window.com&&com.load){ com.load(loadObj);}
                },
                complete:function(){
                    if(window.com&&com.load){ $('#load').hide();}
                }
            })
        };

        this.get = function(url,callback){
            $.get(url,function(data,status){
                callback(data,status)
            });
        };

        this.url = function(url){
            if(path == 'dev'){
                base = "http://192.168.0.111/mobile-featsky/app/api/";
            }else if(path == 'test'){
                base = "http://test.featsky.com/app/api/";
            }else{ base = "http://www.featsky.com/mobile-featsky/app/api/" }
            return base + url + "?workName=" + workName + "&date=" + new Date().getTime();
        };

        this.imgUrl = function(url){
            if(path == 'dev'){
                base = "http://192.168.0.111/mobile-featsky/img/";
            }else if(path == 'test'){
                base = "http://test.featsky.com/img/";
            }else{ base = "http://www.featsky.com/mobile-featsky/img/" }
            return base + url;
        };

    }).apply(app);

}(window);




